import count from '@dfeidao/atom-nodejs/db/count';
import query from '@dfeidao/atom-nodejs/db/query';
interface Message {
	filter: {
		client_type: string;
		productid: string;
		$or: [];
	};
	page_size: number;
	page_no: number;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {

	const { exec, prepare } = query(action_id, session_id, '12');
	prepare('pub_form', ['package_no', 'package_name', 'package_path', 'formid', 'formname', 'group_number'], msg.filter, msg.page_size, msg.page_no, [], []);
	const [data] = await exec();
	// 查询总条数
	const { exec: e, prepare: p } = count(action_id, session_id, '12');
	p('pub_form', msg.filter);
	const [_count] = await e();
	return { dataArray: data, count: _count };
}
